# Maintainer: Maria Lisina <sekoohaka.sarisan@gmail.com>
pkgname=telegram-bot-api
pkgver=7.11
pkgrel=0
# they don't tag releases
_gitrev=6d1b62b51bdc543c10f854aae751e160e5b7b9c5
_td_gitrev=056963e48fa8d3f89556239c22d6ac843d3c8a5b
pkgdesc="Telegram Bot API server"
url="https://core.telegram.org/bots"
arch="all !s390x" # td fails to build on big-endian
license="BSL-1.0"
makedepends="cmake gperf linux-headers openssl-dev samurai zlib-dev"
source="$pkgname-$_gitrev.tar.gz::https://github.com/tdlib/telegram-bot-api/archive/$_gitrev.tar.gz
	td-$_td_gitrev.tar.gz::https://github.com/tdlib/td/archive/$_td_gitrev.tar.gz
	"
options="!check" # package doesn't have a testsuite

builddir="$srcdir/$pkgname-$_gitrev"

prepare() {
	default_prepare

	rm -fr "$builddir/td"
	ln -sf "$srcdir/td-$_td_gitrev" "$builddir/td"
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9dd589dc59718500d9689a9d868c519c11a1e64177b12240ad3db9821e7febb4a8f809ea2aa305ba8dc7903c68e18151e0f7a9c4a01752596d77224474c2e341  telegram-bot-api-6d1b62b51bdc543c10f854aae751e160e5b7b9c5.tar.gz
9392e6267a82142e4c53aa8ef140bbd88d60562f52ffbfcd6c4657248267a9be20b0cc53310cbc54d4918cca1d66c27906a447f3df49fc9b1e4e75f731008c93  td-056963e48fa8d3f89556239c22d6ac843d3c8a5b.tar.gz
"
